UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tNvIGeGDJHYkXgrZTixmfv9SU0jxI8Uz6RBhWT44trk='
WHERE
key_id = '44a1b6a91d38f22de31ac5cf1c271cb03b5032fc5f18ace2f604834ee6a43690'
AND (
token = 'tNvIGeGDJHYkXgrZTixmfv9SU0jxI8Uz6RBhWT44trk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)