UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G6xaUPGcxgD1ktydHzokj9jTiD4KhMuEP+di5IA0w84='
WHERE
key_id = 'a8325c8f0bade943be8d9ecade28234295c8ece0307b1a8f29065b0be6614875'
AND (
token = 'G6xaUPGcxgD1ktydHzokj9jTiD4KhMuEP+di5IA0w84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)