UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fM8hZjI4MyPJkr7ecyCNteqINikZx57J02FX1lHv130=' 
WHERE 
  key_id = '64ac3f4831c8fdbd7eb2c36dc3ae8b6c66f4ee34f4f6316cd3c18acfec52f3f2' 
  AND (
    token = 'fM8hZjI4MyPJkr7ecyCNteqINikZx57J02FX1lHv130=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025