UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rW01VxEHpP/0LROtB8tAGTofy8KqsHnFK9BbBoT7Fds='
WHERE
key_id = 'b22576a6ce3325d32322cd4612b18e24ba8aa8225b5b17fd2d3cd75beb467e72'
AND (
token = 'rW01VxEHpP/0LROtB8tAGTofy8KqsHnFK9BbBoT7Fds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)