UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WCaPzXRcir7MWASC0NRSarEz9FZGBHF2DnPHulblt3E=' 
WHERE 
  key_id = '3c781ee3d504a4edbd5f31510d62c847a339f1b5a0230a44a529687550619e45' 
  AND (
    token = 'WCaPzXRcir7MWASC0NRSarEz9FZGBHF2DnPHulblt3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00097