UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XZnydU7hUnYNNqfy9W+lEGGuzmF3WiEhLxySidLbIjU='
WHERE
key_id = '9f1952f7775ae0acdc1f47787982d7b542922d06f637e2bd03e42b28e39a7674'
AND (
token = 'XZnydU7hUnYNNqfy9W+lEGGuzmF3WiEhLxySidLbIjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)