UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lV7yRbkwaGOdTspfOcoElvUl7qDmYfFAHXlmOs5IbO0='
WHERE
key_id = '623e7c4157a8a9a23c7a66005a70a7f0b4a73a6281e5565fb41284600f466789'
AND (
token = 'lV7yRbkwaGOdTspfOcoElvUl7qDmYfFAHXlmOs5IbO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)