UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X899CqEbx89gTfS5np20v2g7FBHVPMW6TZlU2OaS3MU=' 
WHERE 
  key_id = '163f94489da10346b2060ae7fc33f62e1b47f1a1eb16bfd396a0fbcd3453812d' 
  AND (
    token = 'X899CqEbx89gTfS5np20v2g7FBHVPMW6TZlU2OaS3MU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052