UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'znRhqV93VoJc92mD6vMOVDqsWlKc2KCIBBmu12eym8M='
WHERE
key_id = '8772c4927096f43dedaf119470230e113379685caf26b7b90f829754dc20de25'
AND (
token = 'znRhqV93VoJc92mD6vMOVDqsWlKc2KCIBBmu12eym8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)