UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a80KSsWC3c8jgt9Tuf7ehnVxCoc6X/OzTxXP764nzxA='
WHERE
key_id = '0f502bf621cfadc252ee55c2a1c59a0a899d1162558ab202e4fdfdd0a6b62daa'
AND (
token = 'a80KSsWC3c8jgt9Tuf7ehnVxCoc6X/OzTxXP764nzxA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)