UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YaEd12C3CdlG9DnHy6kGErKKC9RyvuG0x73PbixsL6c=' 
WHERE 
  key_id = '9f19a561e8ec0db5e2599abc1f2bc31c3509c91f5a563db160ab8ac7a591a4d9' 
  AND (
    token = 'YaEd12C3CdlG9DnHy6kGErKKC9RyvuG0x73PbixsL6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028