UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'htdX8yMhqCQllK8Ad4AzEPhdTLpeDQ78p9AsXEBPuiM=' 
WHERE 
  key_id = '33a043bf1b48fe60b41851f2b74564109db144cb6313bac478051a4f2e79a417' 
  AND (
    token = 'htdX8yMhqCQllK8Ad4AzEPhdTLpeDQ78p9AsXEBPuiM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052