UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IdC6uL7Akc1jRKNhMvcTPhGz/t/aIhEO81tmS5MuoQo=' 
WHERE 
  key_id = '1cd699f8ed905c30420242340f2b0f2ee269ac6eb68c0a58886341c816016cd4' 
  AND (
    token = 'IdC6uL7Akc1jRKNhMvcTPhGz/t/aIhEO81tmS5MuoQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034