UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e34k07rex5ueh1AsrrsebT0fzjKkWRHb/4hnzIXNPYc=' 
WHERE 
  key_id = '94a34d87628664d5b75008428917f4be88342e77d941db239ef46861343027b2' 
  AND (
    token = 'e34k07rex5ueh1AsrrsebT0fzjKkWRHb/4hnzIXNPYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041