UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rfsIFx32aelKvmcNJVC/2HFt17ad7MH1k6+qGkWscfI=' 
WHERE 
  key_id = '6929eb85fa75a352896d271762d7878ee285bd1bafea2709e3740218165aa08d' 
  AND (
    token = 'rfsIFx32aelKvmcNJVC/2HFt17ad7MH1k6+qGkWscfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031