UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qB6v61aqrjsJmp4w9FAJ8NSCGUSbGkMCAimt90w6Sc4='
WHERE
key_id = '27f5eed23400861e2244e7ac8ef7ae8e35c05bddf862422086d97684d11a2b84'
AND (
token = 'qB6v61aqrjsJmp4w9FAJ8NSCGUSbGkMCAimt90w6Sc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)