UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZctyTTiaNA9IfyzfcAvNfPNNu0ojC3FA6AUmdABm7lo='
WHERE
key_id = '8950013615bae9708e731a582043d84bdced7c93e3ef6c5c901c6c8c3ed62668'
AND (
token = 'ZctyTTiaNA9IfyzfcAvNfPNNu0ojC3FA6AUmdABm7lo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)