UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xKG7jQPU3DS9w9zGWW2T9kuwBUYJ27r75BhiuzI4slU='
WHERE
key_id = '6b113342fd8d6d084907e0d449fe2a313888639d4f3108356ac32e2fe6e3af1c'
AND (
token = 'xKG7jQPU3DS9w9zGWW2T9kuwBUYJ27r75BhiuzI4slU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)