UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1ZrFUj3PP96avwMf0vLoOQGrrLAtG3eOc+CiV+elDsk='
WHERE
key_id = '1b3c9270a79e14d49cd75a79237dff1d58755458c3025278dbee7b3f08e112b1'
AND (
token = '1ZrFUj3PP96avwMf0vLoOQGrrLAtG3eOc+CiV+elDsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)