UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JC8Sk4nw6zkY1xi4qB24ChziGlZBofE1ANVblpY+iOM='
WHERE
key_id = 'd248f8fbf80028c8adaaef5796880baba5f789ca6333f4de382ded32e0fe56f8'
AND (
token = 'JC8Sk4nw6zkY1xi4qB24ChziGlZBofE1ANVblpY+iOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)