UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NbEAMeEzUeTYfUrpzWhiorUhsx0kA9QhwSNTDqf6DvY=' 
WHERE 
  key_id = '20445731636fa30082fa4909d689a5389e49c1a5af078458a8bfbc61a19de20e' 
  AND (
    token = 'NbEAMeEzUeTYfUrpzWhiorUhsx0kA9QhwSNTDqf6DvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031