UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Vp18MnixeF9nbRfgGumtixIY5btxqtBnY3sgVEV1vU=' 
WHERE 
  key_id = 'c116e7b1439358be722f9bbfc1da98552e9ce19f68ce2706f253518c3f246270' 
  AND (
    token = '6Vp18MnixeF9nbRfgGumtixIY5btxqtBnY3sgVEV1vU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040