UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sx9lcgcCQyAFSnh9R8Dfz3rjF07fk4PX8Ox7FF3YX4g='
WHERE
key_id = '2c13102bcf91397c1de0f8d44993888b52ab46113fbee0e05cfd336f1cfda339'
AND (
token = 'sx9lcgcCQyAFSnh9R8Dfz3rjF07fk4PX8Ox7FF3YX4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)