UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2635hjcuCdvdtvBfyjomNJQ3rbotGhE4l9dfqEMydR8='
WHERE
key_id = '017657d8feb52f44b54a250c2539a24f52868eb65c2c8db98835c776dae9bb14'
AND (
token = '2635hjcuCdvdtvBfyjomNJQ3rbotGhE4l9dfqEMydR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)