UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fpWwjm8XNAIPGH63cc1HxEvp+FTSagD348SXTmxCa4g=' 
WHERE 
  key_id = '26ae4270293936dc695315db18b317b1e3e527d66166d35de222f6578fad3699' 
  AND (
    token = 'fpWwjm8XNAIPGH63cc1HxEvp+FTSagD348SXTmxCa4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033