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