UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v6HPtnKxNns8n3tDWKxidCgQ1UkLOFyTFMHtljcIxv4='
WHERE
key_id = '39f52f090965ecde65988ac6be033a0bfc98f01198e0729c9f4cf8e5b75a145d'
AND (
token = 'v6HPtnKxNns8n3tDWKxidCgQ1UkLOFyTFMHtljcIxv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)