UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xAzHu5oO8d7xYFnu0WtPoIW5T0INeeWpT8eZIuqrcbg=' 
WHERE 
  key_id = '24d5b13255d61b68dadf58aebc849b88d59eae4041af5c311061bfea58bcedb2' 
  AND (
    token = 'xAzHu5oO8d7xYFnu0WtPoIW5T0INeeWpT8eZIuqrcbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035