UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ntffIADm1WJ7cjsSBvaUPZbFGQF35ICW0qMyt5bL4iA='
WHERE
key_id = 'aeb0ef82439ed1b1c28c2a77f8bfaf3f437543ebc2f9855e002528fe1dd42a1b'
AND (
token = 'ntffIADm1WJ7cjsSBvaUPZbFGQF35ICW0qMyt5bL4iA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)