UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cCE04T73a5KVf5NUBlCqvteAtyuFr2ExtC2TeVRtQ+8='
WHERE
key_id = '50a6d57eca5bc487501808871d36796a83fac82a2f6ef4090442e91933ba2bae'
AND (
token = 'cCE04T73a5KVf5NUBlCqvteAtyuFr2ExtC2TeVRtQ+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)