UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ysQAhp+teXtH9mKzO5fhSsXoxEeFEGVn3ulGWgWO7yg=' 
WHERE 
  key_id = '79db568e48faad81df060e23c590c496b9eae75ebfc0de80906f2d9a507bf58b' 
  AND (
    token = 'ysQAhp+teXtH9mKzO5fhSsXoxEeFEGVn3ulGWgWO7yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031