UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XUWhCPd3UIOXYGgEeHt+PfbKOVxVWRTYIxG5wzDv0cI='
WHERE
key_id = '02f0861ff24fee2b07f1bededc471711bf83dac89ab5ac650ecd6ddd9888f680'
AND (
token = 'XUWhCPd3UIOXYGgEeHt+PfbKOVxVWRTYIxG5wzDv0cI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)