UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y3qcCOFLDGQTe3AibgVuLsZO4dDYjaT99KkVpM+pyKA='
WHERE
key_id = 'a0698a363f699a1254b0a2083b5203715ddc40c2888de0118047708cedce5f9a'
AND (
token = 'Y3qcCOFLDGQTe3AibgVuLsZO4dDYjaT99KkVpM+pyKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)