UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ep5yDT4YKuxBDxEQJXNN6m89cfneBvFsSa/l9XH/Fkw=' 
WHERE 
  key_id = '974a0531d707c5413738cb8a0d5634c37fe85aa21993f1f32db2103b51c8e332' 
  AND (
    token = 'Ep5yDT4YKuxBDxEQJXNN6m89cfneBvFsSa/l9XH/Fkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035