UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dKwOoCBYnuvEmRu7phuFqlQe4lHDJRBiWgm+ULxa/e4=' 
WHERE 
  key_id = '038a9670f4e813e223db344081078b702fc2496b968f918220c2dc324b8bdab2' 
  AND (
    token = 'dKwOoCBYnuvEmRu7phuFqlQe4lHDJRBiWgm+ULxa/e4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051