UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXk2dLQa0FbicICO0wB0M9puXfO7cBZTAnflF0AwYxY='
WHERE
key_id = '7af6d22a491d90577ff691d6e868c54982236c447ab165f9cd4ec8e2ff320b22'
AND (
token = 'CXk2dLQa0FbicICO0wB0M9puXfO7cBZTAnflF0AwYxY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)