UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r/Z40F5rST8RsJ5XGeQdOdCcz0zbjCYl+7KskwtjEcU=' 
WHERE 
  key_id = '7deffe8e0fe42a7068c3d2611a88b0afcf0fba06505b44d55aa0ba5aa68017d1' 
  AND (
    token = 'r/Z40F5rST8RsJ5XGeQdOdCcz0zbjCYl+7KskwtjEcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018